// ActionScript file
package com.app.factories
{
    import com.adobe.serialization.json.JSONDecoder;
    import com.app.vo.MahasiswaVO;

    public class MahasiswaFactory
    {

        public static function buildArrayFromJson(json:String):Array
        {     
            var parsedArray:Array= new JSONDecoder( json ).getValue();
            return parsedArray;
        }
        
        public static function buildDokTaMahasiswa(data:String,mhsVo:MahasiswaVO):MahasiswaVO{
            var output:Array= buildArrayFromJson(data);
            mhsVo.mhsDokTugasAkhir=output;
            return mhsVo;
        }
        
        public static function buildInfoMahasiswa(data:String,mhsVo:MahasiswaVO):MahasiswaVO{
            var output:Array = buildArrayFromJson(data);
            mhsVo.mhsId=output[0]['MHS_ID'];
            mhsVo.mhsNIM=output[0]['MHS_NIM'];
            mhsVo.mhsUsername=output[0]['MHS_USERNAME'];
            mhsVo.mhsNama=output[0]['MHS_NAMA'];
            mhsVo.mhsAlamat=output[0]['MHS_ALAMAT'];
            mhsVo.mhsAngkatan=output[0]['MHS_ANGKATAN'];
            mhsVo.mhsEmail=output[0]['MHS_EMAIL'];
            mhsVo.mhsNoTelp=output[0]['MHS_NO_TELP'];
            mhsVo.mhsStatus=output[0]['MHS_STATUS'];
            return mhsVo;
        }
        
        public static function buildTugasAkhirMahasiswa(data:String,mhsVo:MahasiswaVO):MahasiswaVO{
            var output:Array = buildArrayFromJson(data);
            mhsVo.mhsTugasAkhir=output;
            return mhsVo;
        }
        
        public static function buildListDosen(data:String,mhsVo:MahasiswaVO):MahasiswaVO{
            var output:Array = buildArrayFromJson(data);
            mhsVo.mhsDosenList=output;
            return mhsVo;
        }
        

    }
}
